home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_bas
/
apbsu106
/
file-man.bas
< prev
next >
Wrap
BASIC Source File
|
1992-05-29
|
15KB
|
659 lines
start:
' Set up and print intro screen.
cls
print " The ApBASIC File Manager, Version 1.06"
print
print
print " By Matt Roberts
print " 5 Cedar St., # 8
print " Montpelier, Vt 05602-3006
print " (802)223-2553
print
print
print "If you find the files on this disk useful, a donation of $5.00 would be
print "greatly appreciated. Thanks.
print
print
print "If you're having trouble using this program, and the documentation
print "doesn't seem to help, you can call me between 9AM and 9PM EST, and I'll
print "try to help.
print
print
print
gosub presskey
'Opening screen is now set up and printed.
' Now create a menu of options.
menu:
cls
locate 1,35
print "Your options:
print
print
print "1- Work with CONFIG.SYS file. 9- Get time/date."
print
print "2- Work with AUTOEXEC.BAT file. 10-Quit."
print
print "3- Delete files."
print
print "4- Make directory.
print
print "5- Display file contents."
print
print "6- Copy a file."
print
print "7- Get file length."
print
print "8- Move file."
print
print
input "Please press the number of your choice, and then press Enter. ",choice
on choice gosub changecon,chngauto,killfile,makedir,displafl,copyfile,filength,movefile,timedate,quitprog
goto menu
'This is the end of the menu.
'Here is the routine for working with the CONFIG.SYS file.
changecon:
cls
print " View or Change Your CONFIG.SYS File
print
print
input "On which drive is your CONFIG.SYS file";drive$
redrive:
drive$=drive$+"\"
if drive$="a:\" then file1$="a:\config.sys
if drive$="A:\" then file1$="a:\config.sys
if drive$="b:\" then file1$="b:\config.sys
if drive$="B:\" then file1$="b:\config.sys
if drive$="c:\" then file1$="c:\config.sys
if drive$="C:\" then file1$="c:\config.sys
if drive$="d:\" then file1$="d:\config.sys
if drive$="D:\" then file1$="d:\config.sys
if drive$="a:\" then file2$="a:\config.bas
if drive$="A:\" then file2$="a:\config.bas
if drive$="b:\" then file2$="b:\config.bas
if drive$="B:\" then file2$="b:\config.bas
if drive$="c:\" then file2$="c:\config.bas
if drive$="C:\" then file2$="c:\config.bas
if drive$="d:\" then file2$="d:\config.bas
if drive$="D:\" then file2$="d:\config.bas
confmenu:
cls
print "You have the following options:"
print
print
print "1- Just view the CONFIG.SYS file."
print
print "2- Add lines to the end of your file."
print
print "3- Create a new CONFIG.SYS file."
print
print "4- Return to the Main Options Menu."
print
print
print
input "Please press the number corresponding to your choice, and then press Enter. ",chngview$
if chngview$="1" then cls:gosub seesys:goto confmenu
if chngview$="2" then cls:gosub appendln:gosub seesys:goto confmenu
if chngview$="3" then cls:goto newfilec
if chngview$="4" then goto menu
goto confmenu
'This section creates a new CONFIG.SYS file.
newfilec:
cls
open file1$ for input as 1
open file2$ for output as 2
while not eof(1)
line input # 1, a$
print# 2, a$
wend
close # 1
close # 2
kill file1$
print
print
print "Your CONFIG.SYS file has been changed to CONFIG.BAS in order to save it for
print "future use. To use it later, it will have to be renamed to something else
print "(for example, CONFIG.X)."
print
print
print
gosub presskey
changeagn:
cls
open file1$ for output as 1
print "How many files do you want?
input "To quit, press Q and Enter. ",filenumb$
if filenumb$="q" or filenumb$="Q" then goto restorec
print# 1, "files=";filenumb$
print
print
print
input "How many buffers do you want";buffer$
print# 1, "buffers=";buffer$
devcagain:
print
input "Which device would you like to include (N for none)";device$
if device$="n" or device$="N" then goto nodevice
print# 1, "devices=";device$
print
input "Would you like to include more devices";incldmore$
if incldmore$="y" or incldmore$="Y" then goto devcagain
nodevice:
print
input "Do you want Break on or off (if not sure, type OFF)";breakyn$
if breakyn$="on" or breakyn$="ON" then print# 1, "break=on
close # 1
gosub seesys
print
print
print
print "If this is not O.K. AND you want to go back and change the file, press C and
print "then press Enter."
print
print "To restore your original CONFIG.SYS file, press R and Enter.
print
input "If you're happy with it as is, type OK and Enter. ",change$
okdecide:
if change$="c" or change$="C" then goto changeagn
if change$="r" or change$="R" then goto restorec
if change$="ok" or change$="OK" then goto confmenu
print
input "You must choose between C, R, or OK. ",change$:goto okdecide
restorec:
cls
reset
kill file1$
open file2$ for input as 1
open file1$ for output as 2
while not eof(1)
line input # 1, a$
print# 2, a$
wend
reset
print "Your original CONFIG.SYS file has been restored."
gosub presskey
goto confmenu
'This is the end of the routine for working with the CONFIG.SYS file.
' Here is the routine for working with the AUTOEXEC.BAT file.
chngauto:
cls
print " View or Change Your AUTOEXEC.BAT File
print
print
input "On which drive is your AUTOEXEC.BAT file";drive$
redrivea:
drive$=drive$+"\"
if drive$="a:\" then file1$="a:\autoexec.bat"
if drive$="A:\" then file1$="a:\autoexec.bat"
if drive$="b:\" then file1$="b:\autoexec.bat"
if drive$="B:\" then file1$="b:\autoexec.bat"
if drive$="c:\" then file1$="c:\autoexec.bat"
if drive$="C:\" then file1$="c:\autoexec.bat"
if drive$="d:\" then file1$="d:\autoexec.bat"
if drive$="D:\" then file1$="d:\autoexec.bat"
if drive$="e:\" then file1$="e:\autoexec.bat"
if drive$="E:\" then file1$="e:\autoexec.bat"
if drive$="a:\" then file2$="a:\autoexec.bas"
if drive$="A:\" then file2$="a:\autoexec.bas"
if drive$="b:\" then file2$="b:\autoexec.bas"
if drive$="B:\" then file2$="B:\autoexec.bas"
if drive$="c:\" then file2$="c:\autoexec.bas"
if drive$="C:\" then file2$="c:\autoexec.bas"
if drive$="d:\" then file2$="d:\autoexec.bas"
if drive$="D:\" then file2$="d:\autoexec.bas"
if drive$="e:\" then file2$="e:\autoexec.bas"
if drive$="E:\" then file2$="e:\autoexec.bas"
automenu:
cls
print "You have the following options:"
print
print
print "1- Just view the AUTOEXEC.BAT file."
print
print "2- Add lines to the end of your file."
print
print "3- Create a new AUTOEXEC.BAT file."
print
print "4- Return to the Main Options Menu.
print
print
print
input "Please press the number corresponding to your choice, and then press Enter. ",chngauto$
if chngauto$="1" then
cls
gosub autolook
goto automenu
elseif chngauto$="2" then
cls
gosub appndaut
gosub autolook
goto automenu
elseif chngauto$="3" then
cls
goto newauto
elseif chngauto$="4" then
cls
return
else
goto automenu
end if
' This routine creates a new AUTOEXEC.BAT file.
newauto:
cls
open file1$ for input as 1
open file2$ for output as 2
while not eof(1)
line input # 1, a$
print # 2, a$
wend
close # 1
close # 2
kill file1$
cls
print "Your AUTOEXEC.BAT file has been changed to AUTOEXEC.BAS in order to
print "save it for later use. To use it later, you will have to
print "rename it AUTOEXEC.BAT after renaming the current AUTOEXEC.BAT to
print "something else (for example, AUTOEXEC.X)."
print
print
gosub presskey
scndchng:
cls
open file1$ for output as 1
print "Please type the first line you want, then press Enter (Q to quit).
print
input "> ",firstln$
if firstln$="q" then
goto nochange
elseif firstln$="Q" then
goto nochange
end if
print # 1, firstln$
contline:
print
print "Please type your next line, followed by Enter (Q to quit).
print
input "> ",nextline$
if nextline$="q" then
goto stopchng
elseif nextline$="Q" then
goto stopchng
end if
print # 1, nextline$
goto contline
stopchng:
close # 1
cls
gosub autolook
print
print
print
print "If this is not O.K. AND you want to change it, press C and then Enter."
print
print "To restore your original AUTOEXEC.BAT, press R and then Enter.
print
input "If you're happy with it as is, type OK and Enter. ",changeyn$
rechange:
if changeyn$="c" then
goto scndchng
elseif changeyn$="C" then
goto scndchng
elseif changeyn$="r" then
goto nochange
elseif changeyn$="R" then
goto nochange
elseif changeyn$="ok" then
goto automenu
elseif changeyn$="OK" then
goto automenu
elseif changeyn$="oK" then
goto automenu
elseif changeyn$="Ok" then
goto automenu
end if
print
input "You must choose C, R, or OK. ",changeyn$
goto rechange
nochange:
cls
reset
kill file1$
open file2$ for input as 1
open file1$ for output as 2
while not eof(1)
line input # 1, a$
print # 2, a$
wend
reset
print "Your original AUTOEXEC.BAT file has been restored.
gosub presskey
goto automenu
' This is the end of the routine for working with the AUTOEXEC.BAT file.
' Here is the routine for deleting files.
killfile:
cls
print " Delete Files
print
print
print "Before going any further you should be aware that, once a file has"
print "been deleted, it is very difficult to retrieve it. From this program,"
print "it is impossible; there is no undelete option available."
print
deletagn:
input "Press Enter to continue, or Q and Enter to quit. ",contyn$
if contyn$="q" or contyn$="Q" then return
cls
input "File to delete (include drive and path)";file$
print
print
print "All the data in "ucase$(file$)" will be destroyed."
print
print
input "Press Enter to continue or Q and Enter to quit. ",contyn$
if contyn$="q" or contyn$="Q" then return
kill file$
print
print
print ucase$(file$)" has been deleted."
print
another:
input "Delete another";delagain$
if delagain$="y" or delagain$="Y" then goto deletagn
if delagain$="n" or delagain$="N" then
print
return
end if
cls
goto another
' This is the end of the routine for deleting files.
makedir:
cls
print " Make a Directory"
print
print
mkdagain:
input "Which drive (Q to quit)";drive$
if drive$="q" or drive$="Q" then return
redrivem:
print
input "Directory name (include path)";directory$
directory$=drive$+"\"+directory$
mkdir directory$
print
print
print
print "You have created directory: "ucase$(directory$)
print
print
input "Would you like to make another directory";makeagn$
if makeagn$="y" or makeagn$="Y" then
print
print
goto mkdagain
end if
return
'This is the end of the routine for making directories.
'Here is the routine for displaying file contents.
displafl:
cls
displagn:
print " View File Contents"
print
print
print "Which file (include drive and path)?"
input "Press Q and Enter to quit. ",whatfile$
if whatfile$="q" or whatfile$="Q" then return
cls
print "To pause, press Ctrl-Num Lock."
print
print "Special characters used in ";ucase$(whatfile$)
print "may not print in exactly the same manner as the original."
print
print "Also, formatting may not be quite correct."
refiledf:
gosub presskey
cls
open whatfile$ for input as 1
while not eof(1)
line input # 1, a$
print a$
wend
close 1
print
input "Do you want to view more files";viewmore$
if viewmore$="y" or viewmore$="Y" then goto displagn
return
'This is the end of the routine for displaying files.
'Here is the routine for copying text files.
copyfile:
redo:
cls
print " Copy Text File"
print
print
print "*****PLEASE NOTE***** .EXE and .COM files will not copy properly. While"
print "other files have not yet been tested, it is probably safe to assume that"
print "any file that contains special characters may not copy properly. As"
print "far as I know, the original is not affected, but I'm making no guarantees"
print "on that score, either. Please use backups for any testing, until you"
print "are confident that things will go smoothly."
gosub presskey
copymore:
cls
print "Text file to copy (include drive and path)?"
input "Press Q and Enter to quit. ",sourcefl$
resource:
if sourcefl$="q" or sourcefl$="Q" then return
open sourcefl$ for input as 1
print
print "Destination (include drive and path)?"
input "Press Q and Enter to quit. ",destiny$
if destiny$="q" or destiny$="Q" then
close 1
return
end if
goahead:
open destiny$ for output as 2
while not eof(1)
line input # 1, a$
print # 2, a$
wend
reset
print
print
print ucase$(sourcefl$)" has been copied to "ucase$(destiny$)"."
print
input "Copy another";copyagn$
if copyagn$="y" or copyagn$="Y" then goto copymore
gosub presskey
return
'This is the end of the routine for copying a text file.
filength:
return
movefile:
return
timedate:
return
quitprog:
cls
end
' Here is the routine for looking at the CONFIG.SYS file.
seesys:
reset
cls
print "Here is your file:"
print
open file1$ for input as 1
while not eof(1)
line input # 1, a$
print a$
wend
close # 1
gosub presskey
return
'This is the end of the routine for looking at the CONFIG.SYS file.
'Here is the routine for adding lines to the end of CONFIG.SYS.
appendln:
reset
open file1$ for append as 1
appendagn:
print
input "Line to add (Q to quit)";appendln$
if appendln$="q" or appendln$="Q" then close # 1:return
print# 1, appendln$
goto appendagn
'This is the end of the routine for adding lines to CONFIG.SYS.
' Here is the routine for looking at the AUTOEXEC.BAT file.
autolook:
cls
reset
print "Here is your file:"
print
print
open file1$ for input as 1
while not eof(1)
line input # 1, a$
print a$
wend
close # 1
gosub presskey
return
' This is the end of the routine for looking at the AUTOEXEC.BAT file.
' Here is the routine for adding lines to the end of AUTOEXEC.BAT.
appndaut:
cls
reset
open file1$ for append as 1
appndagn:
print
input "Line to add (Q to quit)";appendln$
if appendln$="q" then
close # 1
return
elseif appendln$="Q" then
close # 1
return
end if
print # 1, appendln$
goto appndagn
' This is the end of the routine for adding to the end of AUTOEXEC.BAT.
'Here is the routine for waiting for the user to press any key to continue.
presskey:
print
print
print "Press any key to continue. "
wait:
wait$=inkey$
if wait$="" then goto wait
return